#!/bin/bash

# Take the first argument
command=$1
# Shift the arguments so we can process the rest
shift

# Interval is either 5 or whatever is supplied as the second argument
i=${1:-5}

level() {
	# xbacklight | awk '{print int(($1 + 2.5) / 5) * 5}'
  MAX="$(brightnessctl -d intel_backlight m)"
  CURRENT="$(brightnessctl -d intel_backlight g)"
  LEVEL=$((($CURRENT*100)/$MAX))
  echo $LEVEL
}

case $command in
	-|down) brightnessctl -d intel_backlight s ${i}%- >/dev/null;;
	+|up) brightnessctl -d intel_backlight s +${i}% >/dev/null;;
	*) brightnessctl -d intel_backlight s $1 >/dev/null;;
esac

notify-send "Brightness" -h int:value:`level` -t 1000 -u low
